<?php
/**
 * Created by PhpStorm.
 * User: lili
 * Date: 2018/11/21
 * Time: 14:04
 */

namespace app\admin\model;


use think\Model;
use traits\model\SoftDelete;

class User extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $autoWriteTimestamp = true;


    
    
    /*
     * 搜索所有的用户
     *
     * */
    public function getAllUser($page=1,$limit=10){


        $start = ($page-1)*$limit;
        $users = $this->limit($start,$limit)->select();

        //$users = $this->query($sql);
        return $users;
    }


    /*
     *
     * 通过uid获得用户
     *
     *
     * */

    public function getUserByuid($uid){
        $w['uid'] = $uid;
        $user = $this->where($w)->find();
        return $user;
    }
    
    /*
     * 获得用户总数
     * 
     * */
    public function getCount(){
        $count = $this->count();
        return $count;
    }

}